<template>
	<baseDialog ref="dialogRef" :title="dialogTitle" width="680px" :showFooter="false" @close="handleClose">
        <el-table :data="formData" style="width: 100%">
            <el-table-column prop="column_name" label="字段名称" />
            <el-table-column prop="column_type" label="字段类型" />
            <el-table-column prop="column_comment" label="字段注释" />
        </el-table>
	</baseDialog>
</template>

<script setup lang="ts" name="databaseDetail">
import { ref, computed } from 'vue';
import { dbMysqlDetail } from '/@/api/setting/db';

const dialogRef = ref(null);

const dialogTitle = computed(() => {
	return '表详情';
});

const emit = defineEmits(['close']);

const formData = ref([]);

const setFormData = async (row: any, callback: any) => {
	const data = await dbMysqlDetail({
		table_name: row.Name,
	});

    formData.value = data;

	callback();
};

const handleClose = () => {
	emit('close');
};

const open = () => {
	dialogRef.value?.open();
};

defineExpose({
	open,
	setFormData,
});
</script>
